package com.ruoyi.report.forms.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.report.forms.domain.ReportFormsBundle;
import com.ruoyi.report.forms.service.IReportFormsBundleService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2024-04-01
 */
@RestController
@RequestMapping("/bundle")
public class ReportFormsBundleController extends BaseController
{
    @Autowired
    private IReportFormsBundleService reportFormsBundleService;

    /**
     * 查询【请填写功能名称】列表
     */
    /*@RequiresPermissions("system:bundle:list")*/
    @GetMapping("/list")
    public TableDataInfo list(ReportFormsBundle reportFormsBundle)
    {
        startPage();
        List<ReportFormsBundle> list = reportFormsBundleService.selectReportFormsBundleList(reportFormsBundle);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    /*@RequiresPermissions("system:bundle:export")*/
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ReportFormsBundle reportFormsBundle)
    {
        List<ReportFormsBundle> list = reportFormsBundleService.selectReportFormsBundleList(reportFormsBundle);
        ExcelUtil<ReportFormsBundle> util = new ExcelUtil<ReportFormsBundle>(ReportFormsBundle.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    /*@RequiresPermissions("system:bundle:query")*/
    @GetMapping(value = "/{routeId}")
    public AjaxResult getInfo(@PathVariable("routeId") String routeId)
    {
        return success(reportFormsBundleService.selectReportFormsBundleByRouteId(routeId));
    }

    /**
     * 新增【请填写功能名称】
     */
    /*@RequiresPermissions("system:bundle:add")*/
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ReportFormsBundle reportFormsBundle)
    {
        return toAjax(reportFormsBundleService.insertReportFormsBundle(reportFormsBundle));
    }

    /**
     * 修改【请填写功能名称】
     */
    /*@RequiresPermissions("system:bundle:edit")*/
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ReportFormsBundle reportFormsBundle)
    {
        return toAjax(reportFormsBundleService.updateReportFormsBundle(reportFormsBundle));
    }

    /**
     * 删除【请填写功能名称】
     */
    /*@RequiresPermissions("system:bundle:remove")*/
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{routeIds}")
    public AjaxResult remove(@PathVariable String[] routeIds)
    {
        return toAjax(reportFormsBundleService.deleteReportFormsBundleByRouteIds(routeIds));
    }

    /**
     * 多条件删除单个数据
     */
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public AjaxResult remove(@RequestBody ReportFormsBundle reportFormsBundle)
    {
        return toAjax(reportFormsBundleService.deleteReportFormsBundleByModel(reportFormsBundle));
    }
}
